<layout name='Layout/layout_main' />
<script type="text/javascript">
	function save() {

		if ($(":checkbox:checked").length == 0) {
			alert("请至少选择一项");
			$("#sender_check").focus();
			return;
		}

		if (($("#sender_check").attr("checked") == "checked") && ($("#sender_key").val() == "")) {
			alert("内容不能为空");
			$("#sender_key").focus();
			return;
		}

		if (($("#domain_check").attr("checked") == "checked") && ($("#domain_key").val() == "")) {
			alert("内容不能为空");
			$("#domain_key").focus();
			return;
		}

		if (($("#recever_check").attr("checked") == "checked") && ($("#recever_key").val() == "")) {
			alert("内容不能为空");
			$("#recever_key").focus();
			return;
		}

		if (($("#title_check").attr("checked") == "checked") && ($("#rtitle_key").val() == "")) {
			alert("内容不能为空");
			$("#title_key").focus();
			return;
		}
		if ($("#to").val() == "") {
			alert("请选择文件夹");
			$("#to").focus();
			return;
		}
		sendForm("form_data", "{:U('save')}");
	}


	$(document).ready(function() {
		$("div.combo input").focus(function() {
			$(this).parent().find("label").hide();
		})

		$("div.combo input").blur(function() {
			if ($(this).val().length == 0) {
				$(this).parent().find("label").show();
			}
		})
		set_val("to", "{$vo.to}");
		$("div.combo input").each(function() {
			if ($(this).val().length > 1) {
				$(this).parent().find("label").hide();
			}
		})
	}); 
</script>
<div class="title panel panel-default">
	<div class="panel-body">
		<h3 class="col-md-12">新建邮件分类</h3>
	</div>
</div>
<form method='post' id="form_data" name="form_data"  class="well form-horizontal">
	<input type="hidden" name="opmode" id="opmode" value="add">
	<div class="form-group col-md-12">
		<label class="col-md-3 control-label" for="is_del">状态：</label>
		<div class="col-md-9">
			<input class="form-control" type="text" id="is_del" name="is_del" >
		</div>
	</div>

	<div class="form-group col-md-12">
		<label class="col-md-3 control-label" for="sender_check">邮件到达时：</label>
		<div class="col-md-9 form-inline">
			<div class="checkbox">
				<input type="checkbox" name="sender_check" id="sender_check" value="1">
			</div>
			<label class="control-label" for="sender_check">如果发件人 </label>
			<select class="form-control col-8" type="select-one" id="sender_option" name="sender_option"  >
				<option selected="selected" value="1">包含</option>
				<option value="0">不包含</option>
			</select>
			<input class="form-control col-20" type="text"  name="sender_key"  id="sender_key">
			<span class="help-inline">例如：abc@abc.com</span>
		</div>
	</div>

	<div class="form-group col-md-12">
		<label class="col-md-3 control-label" for="domain_check">邮件到达时：</label>
		<div class="col-md-9 form-inline">
			<div class="checkbox">
				<input type="checkbox" name="domain_check" id="domain_check" value="1">
			</div>
			<label class="control-label" for="domain_check">如果发件域 </label>
			<select class="form-control col-8" type="select-one" id="domain_option" name="domain_option"  >
				<option selected="selected" value="1">包含</option>
				<option value="0">不包含</option>
			</select>
			<input class="form-control col-20" type="text"  name="domain_key"  id="domain_key">
			<span class="help-inline">例如：@qq.com</span>
		</div>
	</div>

	<div class="form-group col-md-12">
		<label class="col-md-3 control-label" for="recever_check">邮件到达时：</label>
		<div class="col-md-9 form-inline">
			<div class="checkbox">
				<input type="checkbox" name="recever_check" id="recever_check" value="1">
			</div>
			<label class="control-label" for="recever_check">如果收件人 </label>
			<select class="form-control col-8" type="select-one" id="recever_option" name="recever_option"  >
				<option selected="selected" value="1">包含</option>
				<option value="0">不包含</option>
			</select>
			<input class="form-control col-20" type="text"  name="recever_key"  id="recever_key">
			<span class="help-inline">例如：abc@abc.com</span>
		</div>
	</div>

	<div class="form-group col-md-12">
		<label class="col-md-3 control-label" for="title_check">邮件到达时：</label>
		<div class="col-md-9 form-inline">
			<div class="checkbox">
				<input type="checkbox" name="title_check" id="title_check" value="1">
			</div>
			<label class="control-label" for="title_check">如果标题中 </label>
			<select class="form-control col-8" type="select-one" id="title_option" name="title_option"  >
				<option selected="selected" value="1">包含</option>
				<option value="0">不包含</option>
			</select>
			<input class="form-control col-20" type="text"  name="title_key"  id="title_key">
			<span class="help-inline">例如：abc@abc.com</span>
		</div>
	</div>
	<hr>
	<div class="form-group col-md-12">
		<label class="col-md-3 control-label" for="title_check">满足以上条件时：</label>
		<div class="col-md-9">
			<select class="form-control col-20" width:130px;" type="select-one"  id="to" name="to" >
				<option>移动到...</option>
				<volist name="mail_folder" id="vo" >
					<option value="{$vo.id}">
						<php>
							echo str_repeat("&nbsp;&nbsp;",$vo['level'])
						</php> {$vo.name} </option>
				</volist>
			</select>
		</div>
	</div>

	<div class="action">
		<input class="btn btn-default" type="button" value="保存" onclick="save();">
		<input  class="btn btn-default" type="button" value="取消" onclick="go_return_url();">
	</div>
</form>
</div>